/*
 * Copyright 2002-2006 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 control.add(getTaskPanel(), "0, 0, 1, 3");
 * License for the specific language governing permissions and limitations under
 * the License.
 import com.jgoodies.forms.layout.FormLayout;
 */
package net.jwtools.tmt.ui;

import javax.swing.JComponent;

import net.jwtools.tmt.service.IVisitService;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.richclient.application.PageComponentContext;
import org.springframework.richclient.application.support.AbstractView;

public class HomeView extends AbstractView implements ApplicationListener {
	{
		// Set Look & Feel
		try {
			javax.swing.UIManager
					.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private IVisitService visitService;

	/**
	 * Default constructor.
	 */
	public HomeView() {
	}

	public IVisitService getVisitService() {
		return visitService;
	}

	public void setVisitService(IVisitService visitService) {
		this.visitService = visitService;
	}

	protected void initListeners() {

	}

	/**
	 * Register the local command executors to be associated with named
	 * commands. This is called by the platform prior to making the view
	 * visible.
	 */
	protected void registerLocalCommandExecutors(PageComponentContext context) {
	}

	/**
	 * Handle an application event. This will notify us of object adds, deletes,
	 * and modifications. Forward to our object table for handling.
	 * 
	 * @param e
	 *            event to process
	 */
	public void onApplicationEvent(ApplicationEvent e) {
	}

	@Override
	protected JComponent createControl() {
		return new SummaryJPanel(getVisitService());
	}

}